package com.tengju.data.infrastructure.repository;

import com.tengju.data.domain.model.report.BonusSettleRecord;
import com.tengju.data.domain.model.report.BonusSettleRecordRepository;
import com.tengju.data.infrastructure.persistence.mybatis.dataobject.BonusSettleRecordDO;
import com.tengju.data.infrastructure.persistence.mybatis.mapper.tengju.custom.BonusSettleRecordDOCustomMapper;
import com.tengju.data.infrastructure.repository.convert.BonusSettleRecordConvert;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 * @author chenhang
 * @Date 2021/4/19
 */
@Repository
@Slf4j
@RequiredArgsConstructor(onConstructor_ = {@Autowired})
public class BonusSettleRecordRepositoryImpl implements BonusSettleRecordRepository {

    private final BonusSettleRecordDOCustomMapper bonusSettleRecordDOCustomMapper;

    @Override
    public void insert(BonusSettleRecord record) {
        BonusSettleRecordDO bonusSettleRecordDO = BonusSettleRecordConvert.toDO(record);
        if (bonusSettleRecordDO == null) {
            return;
        }
        bonusSettleRecordDOCustomMapper.insert(bonusSettleRecordDO);
    }
}
